<!DOCTYPE HTML>
<html>
<head>
   <meta charset="UTF-8" />
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
    <title>title</title>
    <script type="text/javascript" src="../../script/s94.js#debug"></script>
    <!--公共部分-->
    <script type="text/javascript" src="../../script/common.js"></script>
    <link href="../../css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
!function(){
	var dpm;
	if(dpm = window.location.href.match(/[\?\&]displayMetrics=([^\&]+)(\&|$)/)){
    	displayMetrics = JSON.parse(decodeURIComponent(dpm[1]));
    	set_rem();
    }
}()
</script>
</head>
<style type="text/css">
	.body{font-size: 0.28rem;background: #009D54;}
	.body .button{margin: 0.1rem;}
	.title{width: 100%;margin: 0.6rem 0 0.2rem 0;text-align: center;font-size: 0.36rem;font-weight: bold;}
</style>
<body>
	<header class="public">
		<div class="set-xy full">悬浮窗中</div>
	</header>
	<div class="body">
		<p class="title">悬浮窗中</p>
		
		<div class="button" data='{"name":"test"}' act="hide">隐藏</div>
		<div class="button" data='{"name":"test"}' act="remove">移除</div>
		
		
		<div class="button" act="offset">改变位置</div>
		<div class="button" act="size">改变大小</div>
		<div class="button" act="noTouch">不能触摸</div>
		<div class="button" act="noLimit">可以显示到屏幕外</div>
		<div class="button" act="center">居中</div>
		<div class="button" act="canFocus">可以获取焦点</div>
		<div class="button" act="followTouch">跟随触摸移动</div>
		<div class="button" act="stickSide">自动贴边</div>
		<div class="button" act="event">发送消息给APP</div>

		<input type="text" value="" placeholder="获取焦点后可编辑" >
		
		<p class="title eval-msg"></p>
	</div>
</body>
<script type="text/javascript">
//每个方法传递的参数
var params = {
	hide : {"name":"test"},
	remove : {"name":"test"},
	
	offset : {"name":"test","x":200,"y":200},
	size : {"name":"test","w":200,"h":200},
	noTouch : {"name":"test","noTouch":true},
	noLimit : {"name":"test","noLimit":true},
	center : {"name":"test","center":true},
	canFocus : {"name":"test","canFocus":true},
	followTouch : {"name":"test","followTouch":true},
	stickSide : {"name":"test","stickSide":true},
	"event" : {"name":"test","eventName":"msg","data":{"txt":"发送消息给APP"}},
}
$('.button[act]').on("click",function(){
	var act = $(this).attr("act"); //获取需要执行的方法名称
	var param = params[act]; //获取执行的方法需要传递的参数
	
	param = JSON.stringify(param); //悬浮窗里面的接口传递的参数必须为json字符串，需要用stringify方法把对象转成字符串
	
	if(window['floatWebView']){ //如果是floatWebView模块打开的悬浮窗，window里面会自带floatWebView对象
		floatWebView[act](param);
	}
})
</script>
</html>
